// 数字枚举
enum Direction {
  Up = 1,
  Down,
  Left,
  Right,
  OF  // 对应的值会自增为5
}
console.log('Direction.Up', Direction.Up)  // 通过键名或者键值
console.log('Direction.Up', Direction[2]) // 可通过键值来获得 键名
console.log(Direction.OF)

enum Directionss {
  Up, // 无初始化值时，默认为0
  Down,
  Left,
  Right,
}

console.log('Directionss.Up', Directionss.Up)


enum Response1 {
  No = 0,
  Yes = 1,
}

function respond(recipient: string, message: Response1): void {
  console.log('message', message)
}

respond("Princess Caroline", Response1.Yes) // 枚举中无的字段则为 undefined